<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


<%@page import="java.util.ArrayList"%>
<%@page import="es.ats.codington.festival.domain.Event"%>
<%@page import="es.ats.codington.festival.domain.Visitor"%>
<html lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Events</title>
<link rel="Stylesheet" type="text/css" href="css/Stylesheet.css">
</head>

<body>


<h1></h1>

<% Visitor v=(Visitor) session.getAttribute("visitor");
boolean isAdmin= v.getIsAdmin();%>
<ul id="menu" align=center>

 <li><form id=NoBox action="vieweventsofuser.htm" method="post"><input id="NoBox" type="submit" name="MyPortal" value="My Portal" /></form></li>
 <li><form id=NoBox action="UpdateVisitorPage.htm" method="post"><input id="NoBox" type="submit" name="Update Personal Data" value="Update Personal Data" /></form></li>
 <li><form id=NoBox action="UpdatePasswordPage.htm" method="post"><input id="NoBox" type="submit" name="Change Password" value="Change Password" /></form></li>
 <% if(isAdmin==true){%>
<li><form id=NoBox action="EventRegistrationPage.htm" method="post"><input id="NoBox" type="submit" name="New Event" value="New Event" /></form></li>
<% }%>
 <li><form id=NoBox action="ShowAllEvents.htm" method="post"><input id="NoBox" type="submit" name="Events" value="Events" /></form></li>
 <li><form id=NoBox action="LogOut.htm" method="post"><input id="NoBox" type="submit" name="LogOut" value="Log Out" /></form></li>
</ul>
               
<table>
<tr height="200" align="left">
<td>
<div id="places" align="left" text-align="left">
  <p id="placetitle">Places</p>
  <ul>

  	<li><b><ins ><a >North</a></b></ins></li>
	<li>	<form  id="places" action="ShowEventsByPlace.htm" method="post">
			<input type="hidden" name="place" value="Stadium">
			<input id="places" type="submit" name="Stadium" value="Stadium" />
			</form></li>
	<li>	<form  id="places" action="ShowEventsByPlace.htm" method="post">
			<input type="hidden" name="place" value="Theater">
			<input id="places" type="submit" name="Theater" value="Theater" />
			</form></li>
	<li>	<form  id="places" action="ShowEventsByPlace.htm" method="post">
			<input type="hidden" name="place" value="Museum">
			<input id="places" type="submit" name="Museum" value="Museum" />
			</form></li>
	<li>	<form  id="places" action="ShowEventsByPlace.htm" method="post">
			<input type="hidden" name="place" value="Large Business">
			<input id="places" type="submit" name="Large Business" value="Large Business" />
			</form></li>
	<li></li>
	<li><b><ins><a>South</a></b></ins></li>
	<li >	<form  id="places" action="ShowEventsByPlace.htm" method="post">
			<input type="hidden" name="place" value="Zoo">
			<input id="places" type="submit" name="Zoo" value="Zoo" />
			</form></li>
	<li >	<form  id="places" action="ShowEventsByPlace.htm" method="post">
			<input type="hidden" name="place" value="Park">
			<input id="places" type="submit" name="Park" value="Park" />
			</form></li>
	<li >	<form  id="places" action="ShowEventsByPlace.htm" method="post">
			<input type="hidden" name="place" value="Traditional Market">
			<input id="places" type="submit" name="Traditional Market" value="Traditional Market" />
			</form></li>
	<li >	<form  id="places" action="ShowEventsByPlace.htm" method="post">
			<input type="hidden" name="place" value="Tourist Attraction">
			<input id="places" type="submit" name="Tourist Attraction" value="Tourist Attraction" />
			</form></li>
  </ul>
</div>
</td>
<td>


<div id="maindiv">

<h2>Festival Registration System</h2>

<h3>Events</h3>


<table id="events" border="2" class="main" align="center">
							
		<%
		Event event=new Event();
		ArrayList<Event> eventList = new ArrayList<Event>();
		eventList = (ArrayList<Event>) request.getAttribute("eventList");
		%>
				<tr>
					<%-- <th>Event Number</th>--%>
					<th>Event Name</th>
					<th>Description</th>
					<th>Duration (min.)</th>
					<th>Event Type</th>
					<th>Seats available</th>
					<th>Seats total</th>
					<th>Place</th>
					<th>Register</th>
				</tr>
									
		<%
		for (int i=0;i<eventList.size();i++) {
		event =eventList.get(i);
		%>
				
					<tr>
					<form action="RegisterforEvent.htm" method="post">
					<input type="hidden" name="idEvent" value=<%=event.getIdEvent()%>> 
					<td align="center"><%=event.getEventName()%></td>
					<td align="center"><%=event.getDescription()%></td>
					<td align="center"><%=event.getDuration()%></td>
					<td align="center"><%=event.getEventType()%></td>
					<td align="center"><%=event.getSeatsAvailable()%></td>
					<td align="center"><%=event.getSeatsTotal()%></td>
					<td align="center"><%=event.getPlace()%></td>
					<td><input type="submit" name="Register" value="Register" /></td>
					</form>
					
					</tr>
					
					<%
					}
					%>
				

</table>
</div>

</td>
</tr>
</table>
<% String error = (String) session.getAttribute("error"); %>

<%if(error!=null){ %>
<script> 
alert ("<%=error%>");
</script>

<% session.setAttribute("error",null);} %>
<% session.setAttribute("actual","ShowAllEvents"); %>
</body>
</html>
